/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.seatunnel.connectors.seatunnel.paimon.config;

import org.apache.seatunnel.api.configuration.Option;
import org.apache.seatunnel.api.configuration.Options;
import org.apache.seatunnel.api.sink.DataSaveMode;
import org.apache.seatunnel.api.sink.SchemaSaveMode;

import java.util.HashMap;
import java.util.Map;

public class PaimonSinkOptions extends PaimonBaseOptions {

    public static final String CHANGELOG_TMP_PATH = "changelog-tmp-path";

    public static final Option<SchemaSaveMode> SCHEMA_SAVE_MODE =
            Options.key("schema_save_mode")
                    .enumType(SchemaSaveMode.class)
                    .defaultValue(SchemaSaveMode.CREATE_SCHEMA_WHEN_NOT_EXIST)
                    .withDescription("schema_save_mode");

    public static final Option<DataSaveMode> DATA_SAVE_MODE =
            Options.key("data_save_mode")
                    .enumType(DataSaveMode.class)
                    .defaultValue(DataSaveMode.APPEND_DATA)
                    .withDescription("data_save_mode");

    public static final Option<Boolean> NON_PRIMARY_KEY =
            Options.key("paimon.table.non-primary-key")
                    .booleanType()
                    .defaultValue(false)
                    .withDescription(
                            "Switch to create table with PK or table without PK, true is table without PK, false is table with PK");

    public static final Option<String> PRIMARY_KEYS =
            Options.key("paimon.table.primary-keys")
                    .stringType()
                    .noDefaultValue()
                    .withDescription(
                            "Default comma-separated list of columns that identify a row in tables (primary key)");

    public static final Option<String> PARTITION_KEYS =
            Options.key("paimon.table.partition-keys")
                    .stringType()
                    .noDefaultValue()
                    .withDescription(
                            "Default comma-separated list of partition fields to use when creating tables.");

    public static final Option<Map<String, String>> WRITE_PROPS =
            Options.key("paimon.table.write-props")
                    .mapType()
                    .defaultValue(new HashMap<>())
                    .withDescription(
                            "Properties passed through to paimon table initialization, such as 'file.format', 'bucket'(org.apache.paimon.CoreOptions)");
}
